<template>
  <view>
    <th-form-item label="样品分析方法" v-if="rdSampleAnalysisEntity.length">
      <text class="text">
        <view style="display: flex; flex-wrap: wrap">
          <view
            v-for="item in rdSampleAnalysisEntity"
            :key="item.id"
            class="result-tag"
            style="margin-right: 10rpx; background-color: #4d80f0"
          >
            {{ item.analysisName }}
          </view>
        </view>
      </text>
    </th-form-item>
    <view style="overflow: auto" class="table-container">
      <table class="analysis-table">
        <tbody>
          <tr>
            <th style="width: 320rpx; min-width: 9.5rem">名称</th>
            <th style="width: 280rpx; min-width: 280rpx">说明</th>
          </tr>
          <tr align="center" v-for="(item, index) in dataList" :key="index">
            <td>
              <view>
                {{ item.analysisName }}
              </view>
            </td>
            <td>
              <view>
                {{ item.analysisDesc }}
              </view>
            </td>
          </tr>
        </tbody>
      </table>
    </view>
    <template v-if="checkFlag == 1 && form.id">
      <assayReport :pid="taskId" :version="0"></assayReport>
    </template>
  </view>
</template>

<script lang="ts" setup>
// import assayReport from '@/pages/pm/assay-report/component/assayReport.vue';
import assayReport from './assayReport.vue';

const rdSampleAnalysisEntity = ref([]);
const dataList = ref([]);
const taskId = ref('');
const checkFlag = ref(0);
const form = reactive({
  id: '',
});
const init = (row) => {
  form.id = row.id;
  rdSampleAnalysisEntity.value = row.rdSampleAnalysisEntity;
  dataList.value = row.rdSampleAnalysisEntity;
  taskId.value = row.id;
  checkFlag.value = row.checkFlag;
};

defineExpose({
  init,
});
</script>
<style lang="scss" scoped>
@import '../../experiment/components/table';

.result-tag {
  padding: 6rpx 14rpx;
  margin: 2rpx 0;
  font-size: 24rpx;
  color: white;
  background-color: #87d068;
  border-radius: 4rpx;
}
</style>
